﻿using BLL;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Model;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;

namespace WebApi.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class FangJiaController : ControllerBase
    {
        public FangJiaController(FangJia_BLL bll,ILogger logger)
        {
            Bll = bll;
            Logger = logger;
        }

        public FangJia_BLL Bll { get; }
        public ILogger Logger { get; }

        /// <summary>
        /// 房价列表
        /// </summary>
        /// <param name="index"></param>
        /// <param name="size"></param>
        /// <param name="SX"></param>
        /// <param name="Count"></param>
        /// <param name="Count2"></param>
        /// <returns></returns>
        [HttpGet("FJShow")]
        public IActionResult FJShow(int index, int size, int SX)
        {
            var Count = 0;
            var Count2 = 0;

            var m=Bll.FJShow(index, size, SX, out Count, out Count2);
            return Ok(new
            {
                data = m,
                Count = Count,
                Count2 = Count2
            });
        }

        /// <summary>
        /// 修改状态
        /// </summary>
        /// <param name="MDid"></param>
        /// <param name="MDZT"></param>
        /// <returns></returns>
        [HttpPost("FJXZT")]
        public IActionResult FJXZT(int FJId, int FJZT)
        {
            
            var m=Bll.FJXZT(FJId, FJZT);
            Logger.LogInformation("修改状态成功");
            return Ok(new
            {
                data = m
            });
        }

      

     
    }
}
